#include "SpecialRoom.hh"
#include <iostream>

SpecialRoom::SpecialRoom(const std::string& description, int effect)
    : Room(description), effect(effect) {}

void SpecialRoom::applyEffect(Character& character) const {
    character.setHealth( effect) ;
    if (character.getHealth() > character.getMaxHealth()) {
        character.setHealth(character.getMaxHealth()) ;
    }
    if (character.getHealth() < 0) {
        character.setHealth(0);
    }
}

void SpecialRoom::display() const {
    Room::display();
    if (effect > 0) {
        std::cout << "This room has a healing effect. You gain " << effect << " health." << std::endl;
    } else if (effect < 0) {
        std::cout << "This room has a damaging effect. You lose " << -effect << " health." << std::endl;
    }
}
SpecialRoom::~SpecialRoom() {// Destructor logic if needed
}
SpecialRoom::SpecialRoom(const SpecialRoom& other) : Room(other) {
    effect = other.effect;
}
SpecialRoom& SpecialRoom::operator=(const SpecialRoom& other) {
    if (this != &other) {
        Room::operator=(other); // Call base class assignment operator
        effect = other.effect;
    }
    return *this;
}